using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
public class DiceBehaviour : BasePoolElement
{
    int x, y;
    public int X => x;
    public int Y => y;

    Vector3 oPos, tPos;

    override public void PoolInit()
    {
        oPos = transform.position;
        base.PoolInit();
    }
    // Start is called before the first frame update
    void Start()
    {
        oPos = transform.position;
        //mouseQueue = new Queue<Vector2>(5);
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    internal void SetID(int i, int j)
    {
        x = i;
        y = j;
    }

    float shakeSpeed = 2;
    public void StartShake()
    {
        shakeStrength += Time.deltaTime * shakeSpeed;
        shakeStrength = Mathf.Clamp(shakeStrength, 0, 0.2f);
        //transform.DOShakePosition(2, new Vector3(0.5f, 0.5f, 0.5f), 20, 90, true);
    }

    public void FixedUpdate()
    {
        
        if (shakeStrength > 0)
        {
            shakeStrength -= Time.deltaTime;
            Shake();
        }
    }

    float shakeStrength;//strength
    void Shake() {
        tPos = oPos + UnityEngine.Random.insideUnitSphere * shakeStrength;
        transform.position = Vector3.Lerp(transform.position, tPos,0.1f);
    }
}
